<template>
  <div class="person">
    <h2>姓名: {{ name }}</h2>
    <h2>年龄: {{ age }}</h2>
    <button @click="changeName">修改姓名</button>
    <button @click="changeAge">修改年龄</button>
    <button @click="showTel">查看联系方式</button>
  </div>
</template>

<script lang="ts" setup name="Person">
import { ref } from 'vue'
let name = ref('张三')
let age = ref(18)
let tel = '111111'

console.log(name) // ref 实例化对象:> RefImpl
console.log(age)
console.log(tel)

// 方法
function showTel() {
  alert(tel)
}
function changeName() {
  name.value = 'ddd'
}
function changeAge() {
  age.value = 11
}
</script>

<style scoped>
.person {
  background-color: #2bc7bd;
  box-shadow: 0 0 10px;
  border-radius: 10px;
  padding: 20px;
}

button {
  /* 上下为0 左右为5 */
  margin: 0 5px;
}
</style>
